home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / grideg / grideg.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  3.3 KB  |  113 lines

  1. VERSION 2.00
  2. Begin Form Grid_Sample 
  3.    BackColor       =   &H00FFFFFF&
  4.    Caption         =   "Grid Sample - Resizable"
  5.    ClientHeight    =   5355
  6.    ClientLeft      =   630
  7.    ClientTop       =   1515
  8.    ClientWidth     =   9495
  9.    Height          =   5760
  10.    Icon            =   GRIDEG.FRX:0000
  11.    Left            =   570
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   5355
  16.    ScaleWidth      =   9495
  17.    Top             =   1170
  18.    Width           =   9615
  19.    Begin SSPanel Panel3D1 
  20.       Alignment       =   6  'Center - TOP
  21.       BackColor       =   &H00C0C0C0&
  22.       BevelInner      =   1  'Inset
  23.       BevelOuter      =   0  'None
  24.       Caption         =   "Sample Grid - Resizable "
  25.       Font3D          =   1  'Raised w/light shading
  26.       FontBold        =   -1  'True
  27.       FontItalic      =   0   'False
  28.       FontName        =   "Futura Md BT"
  29.       FontSize        =   18
  30.       FontStrikethru  =   0   'False
  31.       FontUnderline   =   -1  'True
  32.       ForeColor       =   &H00000000&
  33.       Height          =   5190
  34.       Left            =   75
  35.       Outline         =   -1  'True
  36.       TabIndex        =   0
  37.       Top             =   75
  38.       Width           =   9315
  39.       Begin TextBox Text1 
  40.          Height          =   540
  41.          Left            =   225
  42.          MultiLine       =   -1  'True
  43.          ScrollBars      =   2  'Vertical
  44.          TabIndex        =   2
  45.          Text            =   "Text1"
  46.          Top             =   900
  47.          Width           =   3990
  48.       End
  49.       Begin Grid Grid1 
  50.          Cols            =   5
  51.          Height          =   3390
  52.          Left            =   225
  53.          Rows            =   15
  54.          TabIndex        =   1
  55.          Top             =   1425
  56.          Width           =   8790
  57.       End
  58.    End
  59. Sub Form_Load ()
  60.     Left = 0
  61.     Top = 0
  62.     load_flag = "N"
  63.     grid1.Row = 0
  64.     grid1.RowHeight(0) = 400
  65.     grid1.Col = 1
  66.     grid1.Text = "Column 1"
  67.     grid1.ColWidth(1) = 1600
  68.     grid1.Col = 2
  69.     grid1.Text = "Column 2"
  70.     grid1.ColWidth(2) = 1600
  71.     grid1.Col = 3
  72.     grid1.Text = "Column 3"
  73.     grid1.ColWidth(3) = 1600
  74.     grid1.Col = 4
  75.     grid1.Text = "Column 4"
  76.     grid1.ColWidth(4) = 1600
  77. End Sub
  78. Sub Grid1_Click ()
  79.     text1.SetFocus
  80. End Sub
  81. Sub Grid1_MouseDown (button As Integer, Shift As Integer, X As Single, Y As Single)
  82.     If button = 2 Then
  83.         msg = "Right mouse button pressed"
  84.         MsgBox msg
  85.     End If
  86. End Sub
  87. Sub Grid1_RowColChange ()
  88.     If load_flag = "N" Then
  89.         Exit Sub
  90.     End If
  91.     text1.Text = grid1.Text
  92. End Sub
  93. Sub Text1_Change ()
  94.     grid1.Text = text1.Text
  95. End Sub
  96. Sub Text1_KeyPress (Keyascii As Integer)
  97.     If Keyascii = Key_Return Then
  98.         Const EM_GETLINECOUNT = &H40A
  99.         text1.SetFocus
  100.         hWd% = GetFocus()
  101.         tblc = SendMessage(hWd%, EM_GETLINECOUNT, 0, 0)
  102.         tblc = (tblc) * 225
  103.         If tblc > maxrowheight(grid1.Row) Then
  104.             maxrowheight(grid1.Row) = tblc
  105.             grid1.RowHeight(grid1.Row) = tblc
  106.         End If
  107.         If Len(text1.Text) > maxcolwidth(grid1.Col) Then
  108.             maxcolwidth(grid1.Col) = Len(text1.Text)
  109.             grid1.ColWidth(grid1.Col) = Int(maxcolwidth(grid1.Col) / 14 * 1440)
  110.         End If
  111.     End If
  112. End Sub
  113.